﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Example04_CSharp
{
    class CPolypon
    {
        protected int width, height;
        public void SetValues(int a, int b)
        {
            width = a;
            height = b;
        }
    }
    class CRectangle : CPolypon
    {
        public int area()
        {
            return (width * height);
        }
    }
    class CTriangle : CPolypon
    {
        public int area()
        {
            return (width * height / 2);
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            CRectangle rect = new CRectangle();
            CTriangle trgl = new CTriangle();
            rect.SetValues(4,5);
            trgl.SetValues(4,5);
            Console.WriteLine("rect:{0}",rect.area());
            Console.WriteLine("trgl:{0}",trgl.area());
        }
    }
}
